package dryven.model.binding.proxy;

import java.lang.reflect.Method;
import java.util.Calendar;

import dryven.codegen.asm.ReadableSymbol;
import dryven.codegen.asm.TempValue;
import dryven.codegen.asm.typeinfo.TypeInfo;
import dryven.unittest.models.ExampleModel;

public class ExampleProxy extends ExampleModel implements ReadableSymbol {
	private BindingProxy _proxy;
	
	public ExampleProxy(BindingProxy proxy) {
		super();//take smallest possible constructor but does not have to be the default one, fill up with null if necesary
		this._proxy = proxy;
	}

	@Override
	public int getAge() {
		try {
			Method m = ExampleModel.class.getMethod("getAge", new Class[]{});
			Object[] params = new Object[]{};
			_proxy.methodCalled(m, params);
		} catch (Exception e) {}
		return 0;
	}
	
	@Override
	public String getSomeDependendValue(String foo, String bar) {
		try {
			Method m = ExampleModel.class.getMethod("getSomeDependendValue", new Class[]{String.class,String.class});
			Object[] params = new Object[]{foo,bar};
			_proxy.methodCalled(m, params);
		} catch (Exception e) {}
		return null;
	}

	@Override
	public Calendar getBirthday() {
		// TODO Auto-generated method stub
		return super.getBirthday();
	}

	@Override
	public float getExperience() {
		// TODO Auto-generated method stub
		return super.getExperience();
	}

	@Override
	public long getFilesize() {
		// TODO Auto-generated method stub
		return super.getFilesize();
	}

	@Override
	public byte getFlags() {
		// TODO Auto-generated method stub
		return super.getFlags();
	}

	@Override
	public String getLastname() {
		// TODO Auto-generated method stub
		return super.getLastname();
	}

	@Override
	public String getName() {
		// TODO Auto-generated method stub
		return super.getName();
	}

	@Override
	public double getSavings() {
		// TODO Auto-generated method stub
		return super.getSavings();
	}

	@Override
	public short getTcpPort() {
		// TODO Auto-generated method stub
		return super.getTcpPort();
	}

	@Override
	public boolean isMale() {
		// TODO Auto-generated method stub
		return super.isMale();
	}

	@Override
	public void setAge(int age) {
		// TODO Auto-generated method stub
		super.setAge(age);
	}

	@Override
	public void setBirthday(Calendar birthday) {
		// TODO Auto-generated method stub
		super.setBirthday(birthday);
	}

	@Override
	public void setExperience(float experience) {
		// TODO Auto-generated method stub
		super.setExperience(experience);
	}

	@Override
	public void setFilesize(long filesize) {
		// TODO Auto-generated method stub
		super.setFilesize(filesize);
	}

	@Override
	public void setFlags(byte flags) {
		throw new UnsupportedOperationException();
	}

	@Override
	public void setLastname(String lastname) {
		// TODO Auto-generated method stub
		super.setLastname(lastname);
	}

	@Override
	public void setMale(boolean male) {
		// TODO Auto-generated method stub
		super.setMale(male);
	}

	@Override
	public void setName(String name) {
		// TODO Auto-generated method stub
		super.setName(name);
	}

	@Override
	public void setSavings(double savings) {
		// TODO Auto-generated method stub
		super.setSavings(savings);
	}

	@Override
	public void setTcpPort(short tcpPort) {
		// TODO Auto-generated method stub
		super.setTcpPort(tcpPort);
	}
	
	public boolean foo() {
		this.bar();
		int f = 120;
		if(f>120) {
			return true;
		} else {
			return false;
		}
	}
	
	public void bar() {
		_proxy.methodCalled(null, null);
	}

	@Override
	public TempValue read() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public TypeInfo getTypeInfo() {
		// TODO Auto-generated method stub
		return null;
	}
	
	 
}
